home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / kernel / cvbr next >
Encoding:
Internet Message Format  |  1990-02-09  |  10.6 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i061: cVBR - change vector base register, Part01/01
  5. Message-ID: <11352@xanth.cs.odu.edu>
  6. Date: 9 Feb 90 20:28:34 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: mjl@alison.at (Martin J. Laubach)
  9. Lines: 493
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12. X-Post-Discussions-To: comp.sys.amiga
  13.  
  14. Submitted-by: mjl@alison.at (Martin J. Laubach)
  15. Posting-number: Volume 90, Issue 061
  16. Archive-name: kernel/cvbr
  17.  
  18. [ uuencoded executable included.  ...tad ]
  19.  
  20. This is a small tool that will move the exception vector table (on 68010
  21. or higher).
  22.  
  23.     mjl
  24.  
  25. #!/bin/sh
  26. # This is a shell archive.  Remove anything before this line, then unpack
  27. # it by saving it into a file and typing "sh file".  To overwrite existing
  28. # files, type "sh file -c".  You can also feed this as standard input via
  29. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  30. # will see the following message at the end:
  31. #        "End of archive 1 (of 1)."
  32. # Contents:  Vbr.Asm Vbr.uu vbr.doc
  33. # Wrapped by tadguy@xanth on Fri Feb  9 15:27:53 1990
  34. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  35. if test -f 'Vbr.Asm' -a "${1}" != "-c" ; then 
  36.   echo shar: Will not clobber existing file \"'Vbr.Asm'\"
  37. else
  38. echo shar: Extracting \"'Vbr.Asm'\" \(2540 characters\)
  39. sed "s/^X//" >'Vbr.Asm' <<'END_OF_FILE'
  40. X*
  41. X* Change the vector base register on 68010+
  42. X*
  43. X* by Martin J. Laubach
  44. X*
  45. X
  46. X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  47. X
  48. X    incdir "inc:include.i"
  49. X
  50. X    include "exec/execbase.i"
  51. X    include "exec/libraries.i"
  52. X    include "exec/tasks.i"
  53. X
  54. X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  55. X
  56. X    xdef    main
  57. X
  58. X    xref    _AbsExecBase
  59. X
  60. X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  61. X
  62. Xcall    macro
  63. X    xref    _LVO\1
  64. X    jsr     _LVO\1(a6)
  65. X    endm
  66. X
  67. X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  68. X
  69. Xstdout    equr    d7
  70. XDosBase    equr    a5
  71. XTask    equr    a4
  72. X
  73. X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  74. X
  75. Xmain:    move.l    _AbsExecBase,a6
  76. X    lea    DosName,a1
  77. X    moveq    #0,d0
  78. X    call    OpenLibrary        ; Open DOSBase to chat with user
  79. X    move.l    d0,DosBase
  80. X    tst.l    d0
  81. X    beq    exit
  82. X
  83. X    move.l    d0,a6
  84. X    call    Output            ; get stdout
  85. X    move.l    d0,stdout
  86. X
  87. X    move.l    d0,d1
  88. X    move.l    #SignOn,d2
  89. X    moveq    #SignOnEnd-SignOn,d3
  90. X    call    Write            ; say hello
  91. X
  92. X    move.l    _AbsExecBase,a6
  93. X    cmp.w    #33,LIB_VERSION(a6)
  94. X    bls    noversion        ; check for the right kickstart
  95. X
  96. X    btst.b    #AFB_68010,AttnFlags+1(a6)
  97. X    beq    novbr            ; and the right processor
  98. X
  99. X    move.l    a5,a0
  100. X    lea    getvbr,a5
  101. X    call    Supervisor        ; become SUPERMAN!
  102. X
  103. X    tst.l    d4
  104. X    bne.s    already            ; vbr already set
  105. X
  106. X    move.l    #$400,d0
  107. X    moveq    #0,d1
  108. X    call    AllocMem        ; get memory block for vectors
  109. X    move.l    d0,Memory
  110. X    beq.s    nomem
  111. X
  112. X    sub.l    a0,a0
  113. X    move.l    Memory,a1
  114. X    move.l    #$400,d0
  115. X    call    CopyMem            ; now copy the exception vectors
  116. X
  117. X    move.l    Memory,d4
  118. X    move.l    a5,a0
  119. X    lea    setvbr,a5
  120. X    call    Supervisor
  121. X
  122. Xexit0:    move.l    DosBase,a1
  123. X    move.l    _AbsExecBase,a6
  124. X    call    CloseLibrary        ; clean up
  125. X
  126. Xexit:    moveq    #0,d0
  127. X    rts
  128. X
  129. Xgetvbr:    move.l    a0,a5
  130. X    movec.l    vbr,d4
  131. X    rte
  132. X
  133. Xsetvbr:    move.l    a0,a5
  134. X    movec.l    d4,vbr
  135. X    rte
  136. X
  137. Xalready:
  138. X    move.l    d4,d5
  139. X
  140. X    moveq    #0,d4
  141. X    move.l    a5,a0
  142. X    lea    setvbr,a5
  143. X    call    Supervisor
  144. X
  145. X    move.l    d5,a0
  146. X    sub.l    a1,a1
  147. X    move.l    #$400,d0
  148. X    call    CopyMem
  149. X
  150. X    move.l    d5,a1
  151. X    move.l    #$400,d0
  152. X    call    FreeMem
  153. X
  154. X    move.l    #Already,d2
  155. X    moveq    #AlreadyEnd-Already,d3
  156. X    bra.s    Panic
  157. X
  158. Xnomem:    move.l    #NoMem,d2
  159. X    moveq    #NoMemEnd-NoMem,d3
  160. X    bra.s    Panic
  161. X
  162. Xnovbr:    move.l    #ProcErr,d2
  163. X    moveq    #ProcErrEnd-ProcErr,d3
  164. X    bra.s    Panic
  165. X
  166. Xnoversion:
  167. X    move.l    #VerErr,d2
  168. X    moveq    #VerErrEnd-VerErr,d3
  169. XPanic:    move.l    DosBase,a6
  170. X    move.l    stdout,d1
  171. X    call    Write
  172. X    bra.s    exit0
  173. X
  174. X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  175. X
  176. XMemory:        dc.l 0
  177. XOldTrap:    dc.l 0
  178. X
  179. XDosName:    dc.b 'dos.library',0
  180. XSignOn:        dc.b 'cVBR (c) Copyright 1989 by Martin J. Laubach',10
  181. XSignOnEnd:
  182. XVerErr:        dc.b '*** You need at least version 1.2 of the OS '
  183. X        dc.b 'to use cVBR',10
  184. XVerErrEnd:
  185. XProcErr:    dc.b '*** You really should have an 68010 to run cVBR',10
  186. XProcErrEnd:
  187. XNoMem:        dc.b '*** You haven't got $400 more bytes...',10
  188. XNoMemEnd:
  189. XAlready:    dc.b '*** VBR already changed, reverting to normal',10
  190. XAlreadyEnd:
  191. END_OF_FILE
  192. if test 2540 -ne `wc -c <'Vbr.Asm'`; then
  193.     echo shar: \"'Vbr.Asm'\" unpacked with wrong size!
  194. fi
  195. # end of 'Vbr.Asm'
  196. fi
  197. if test -f 'Vbr.uu' -a "${1}" != "-c" ; then 
  198.   echo shar: Will not clobber existing file \"'Vbr.uu'\"
  199. else
  200. echo shar: Extracting \"'Vbr.uu'\" \(912 characters\)
  201. sed "s/^X//" >'Vbr.uu' <<'END_OF_FILE'
  202. Xbegin 664 Vbr
  203. XM```#\P`````````#``````````(```!\``````````````/I````?"QY````$
  204. XM!$/Y```!%'``3J[]V"I`2H!G``"&+$!.KO_$+@`B`"0\```!('8M3J[_T"QY&
  205. XM````!`QN`"$`%&,``+P(+@```2EG``"H($U+^0```*).KO_B2H1F6"`\```$=
  206. XM`'(`3J[_.B/````!#&=XD<@B>0```0P@/```!`!.KOV0*#D```$,($U+^0``_
  207. XM`*I.KO_B(DTL>0````1.KOYB<`!.=2I(3GI(`4YS*DA.>T@!3G,J!'@`($U+5
  208. XM^0```*I.KO_B($63R2`\```$`$ZN_9`B12`\```$`$ZN_RXD/````<)V+6`<<
  209. XM)#P```&U=@U@$B0\```!A78P8`@D/````4UV."Q-(@=.KO_08(8`````````N
  210. XM`&1O<RYL:6)R87)Y`&-60E(@*&,I($-O<'ER:6=H="`Q.3@Y(&)Y($UA<G1IV
  211. XM;B!*+B!,875B86-H"BHJ*B!9;W4@;F5E9"!A="!L96%S="!V97)S:6]N(#$N*
  212. XM,B!O9B!T:&4@3U,@=&\@=7-E(&-60E(**BHJ(%EO=2!R96%L;'D@<VAO=6QDD
  213. XM(&AA=F4@86X@-C@P,3`@=&\@<G5N(&-60E(**BHJ(%EO=2!H879E;BHJ*B!6"
  214. XM0E(@86QR96%D>2!C:&%N9V5D+"!R979E<G1I;F<@=&\@;F]R;6%L"@````/L'
  215. XM````#``````````(````)@```$X```!H````<@```((```"*````N@```-X`&
  216. XK``#H````\@```/P````````#\@```^D````````#\@```^H````````#\MX`L
  217. X``
  218. Xend
  219. Xsize 628
  220. END_OF_FILE
  221. if test 912 -ne `wc -c <'Vbr.uu'`; then
  222.     echo shar: \"'Vbr.uu'\" unpacked with wrong size!
  223. fi
  224. # end of 'Vbr.uu'
  225. fi
  226. if test -f 'vbr.doc' -a "${1}" != "-c" ; then 
  227.   echo shar: Will not clobber existing file \"'vbr.doc'\"
  228. else
  229. echo shar: Extracting \"'vbr.doc'\" \(4210 characters\)
  230. sed "s/^X//" >'vbr.doc' <<'END_OF_FILE'
  231. X
  232. X
  233. X     Page 1                cVBR's Documentation                 Page 1
  234. X
  235. X
  236. X
  237. X
  238. X
  239. X
  240. X
  241. X
  242. X
  243. X
  244. X
  245. X
  246. X
  247. X
  248. X
  249. X
  250. X
  251. X                                    RM
  252. X                   (c) Copyright 1989 by Martin J. Laubach
  253. X                            All rights reserved
  254. X
  255. X
  256. X
  257. X
  258. X
  259. X
  260. X
  261. X
  262. X  1. Introduction      
  263. X
  264. X       cVBR is a small tool that will move the exception vector table
  265. X     of the CPU somewhere else than it's supposed to be.  
  266. X
  267. X  2. How to     
  268. X
  269. X       Running vbr once will allocate some memory, copy the exception
  270. X     and interrupt vector table, and then change the VBR to point
  271. X     there.  
  272. X
  273. X       Running vbr a second time will copy the tables back where they
  274. X     are supposed to be, and clear the VBR register.  
  275. X
  276. X  3. Advantages      
  277. X
  278. X       There are two advantages I can think of: first, any program
  279. X     that accesses the exception and/or interrupt vectors directly
  280. X     instead of using the exec functions will cease to work --
  281. X     especially those dirty "hacker type" programs (sorry, folks).
  282. X     This in my opinion, really *is* an advantage.  
  283. X       Second, when fast RAM is available, the new vector tables are
  284. X     allocated there. This should result in faster interrupt and
  285. X     exception processing, especially when there is a lot of DMA to
  286. X     chip memory going on (disk accesses, blitter blittings, overscan
  287. X     screens).  
  288. X
  289. X
  290. X
  291. X
  292. X     Advantages
  293. X
  294. X
  295. X     Page 2                cVBR's Documentation                 Page 2
  296. X
  297. X
  298. X  4. What      
  299. X
  300. X       In this archive, you should find the following files: 
  301. X
  302. X             vbr.doc .... What you are reading right now.
  303. X             vbr.asm .... The source for rm.
  304. X             vbr ........ The executable
  305. X
  306. X
  307. X  5. Where      
  308. X
  309. X       If you have any comments, ideas what could or should be
  310. X     improved, bug reports or just like to chat a bit, please feel
  311. X     free to contact me at one of the following addresses... I just
  312. X     *love* receiving mail! 
  313. X
  314. X       Usenet:  mjl@alison.at 
  315. X                ..!uunet!mcsun!tuvie!alison!mjl 
  316. X
  317. X         or 
  318. X
  319. X       FidoNet: "Martin Laubach" at 2:310/3.14 
  320. X
  321. X
  322. X       Looking forward to reading from you, 
  323. X
  324. X             mjl 
  325. X
  326. X
  327. X
  328. X  6. License      
  329. X
  330. X       This material is (c) Copyright 1989 by Martin J. Laubach -- All
  331. X     rights reserved.  
  332. X
  333. X       It may be distributed freely as long as the following
  334. X     restrictions are met: 
  335. X
  336. X       The distributor may charge a fee to recover distribution
  337. X     costs. The fee for diskette distribution should not be more than
  338. X     the cost to obtain the same diskette from Fred Fish.  
  339. X
  340. X       The distributor agrees to cease distributing the programs and
  341. X     data involved if requested to do so by the author.  
  342. X
  343. X       You may copy and distribute verbatim copies of the program's
  344. X     executable code and documentation as you receive it, in any
  345. X     medium, provided that you conspicuously and appropriately
  346. X     publish only the original, unmodified program, with all
  347. X     copyright notices and disclaimers of warranty intact and
  348. X     including all the accompanying documentation, example files and
  349. X     anything else that came with the original.  
  350. X
  351. X       The author will not be liable for any damage arising from the
  352. X
  353. X
  354. X     License
  355. X
  356. X
  357. X     Page 3                cVBR's Documentation                 Page 3
  358. X
  359. X
  360. X     failure of this program to perform as described, or any
  361. X     destruction of other programs or data residing on a system
  362. X     attempting to run the program.  While I know of no damaging
  363. X     errors, the user of this program uses it at his or her own
  364. X     risk.  
  365. X
  366. X
  367. X
  368. X
  369. X
  370. X
  371. X
  372. X
  373. X
  374. X
  375. X
  376. X
  377. X
  378. X
  379. X
  380. X
  381. X
  382. X
  383. X
  384. X
  385. X
  386. X
  387. X
  388. X
  389. X
  390. X
  391. X
  392. X
  393. X
  394. X
  395. X
  396. X
  397. X
  398. X
  399. X
  400. X
  401. X
  402. X
  403. X
  404. X
  405. X
  406. X
  407. X
  408. X
  409. X
  410. X
  411. X
  412. X
  413. X
  414. X
  415. X
  416. X     License
  417. X
  418. X
  419. X     Page 4                cVBR's Documentation                 Page 4
  420. X
  421. X
  422. X  7. Road Map    
  423. X
  424. X
  425. X
  426. X        1. Introduction     ....................................    1
  427. X        2. How to    ...........................................    1
  428. X        3. Advantages     ......................................    1
  429. X        4. What     ............................................    1
  430. X        5. Where     ...........................................    2
  431. X        6. License     .........................................    2
  432. X        7. Road Map    .........................................    4
  433. X
  434. X
  435. X
  436. X
  437. X
  438. X
  439. X
  440. X
  441. X
  442. X
  443. X
  444. X
  445. X
  446. X
  447. X
  448. X
  449. X
  450. X
  451. X
  452. X
  453. X
  454. X
  455. X
  456. X
  457. X
  458. X
  459. X
  460. X
  461. X
  462. X
  463. X
  464. X
  465. X
  466. X
  467. X
  468. X
  469. X
  470. X
  471. X
  472. X
  473. X
  474. X
  475. X
  476. X
  477. X
  478. X     Road Map
  479. X
  480. END_OF_FILE
  481. if test 4210 -ne `wc -c <'vbr.doc'`; then
  482.     echo shar: \"'vbr.doc'\" unpacked with wrong size!
  483. fi
  484. # end of 'vbr.doc'
  485. fi
  486. echo shar: End of archive 1 \(of 1\).
  487. cp /dev/null ark1isdone
  488. MISSING=""
  489. for I in 1 ; do
  490.     if test ! -f ark${I}isdone ; then
  491.     MISSING="${MISSING} ${I}"
  492.     fi
  493. done
  494. if test "${MISSING}" = "" ; then
  495.     echo You have the archive.
  496.     rm -f ark[1-9]isdone
  497. else
  498.     echo You still need to unpack the following archives:
  499.     echo "        " ${MISSING}
  500. fi
  501. ##  End of shell archive.
  502. exit 0
  503. -- 
  504. Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
  505. Mail comments to the moderator at <amiga-request@cs.odu.edu>.
  506. Post requests for sources, and general dicussion to comp.sys.amiga.
  507.